﻿using HZU.ZP.Data.Impl;
using HZU.ZP.Data.Interfaces;
using HZU.ZP.Domain.IService;
using HZU.ZP.Domain.Model;
using HZU.ZP.Domain.ServiceImpl.Mappers;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc
{
    public class CompanyInformationService:ICompanyInformationService
    {
        private CompanyInformationMapper _mapper = new CompanyInformationMapper();
        private ICompanyInformationDao _sqlData;
        public CompanyInformationService(ICompanyInformationDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool Add(CompanyInformation companyInformation)
        {
            var companyInformationDao = _mapper.MapToDao(companyInformation);
            _sqlData.Add(companyInformationDao);
            return true;
        }

        public CompanyInformation Get(int companyId)
        {
            return _mapper.MapToDomain(_sqlData.Get(companyId));
        }

        public bool Update(CompanyInformation companyInformation)
        {
            var companyInformationDao = _mapper.MapToDao(companyInformation);
            _sqlData.Update(companyInformationDao);
            return true;
        }
    }
}
